Tag Archives: Software development

LQL 0.7.0 released

Another new version of LQL is available.

0.7.0 changes:

  • Add some new test programs to the tests directory.
  • Fixed a bunch of small bugs that were found with the new test programs.
  • Change the return type of a few _new() functions from GObject to the proper object type.
  • Update docs to match new API.
  • Add some background comments to the documentation.
  • Add support for the DSMark QDisc and corresponding documentation.
  • Add –with-kernel-source=PATH option to configure so alternate kernel include directories can be specified.
  • Add support for the Netem QDisc (everything but distribution tables). This means you now need the headers from a kernel with Netem support in order to compile LQL.
  • Add support for the TCIndex classifier.
  • Put some more time into the classifiers. Still not complete.

Linux QoS API update

My Linux QoS library is coming along nicely. It took me a few days but I changed the whole API to be based on GObject. The main reason for this time consuming change is to make bindings to other languages easier. Primarly I am interested in Mono and Python bindings. As much as I love good old C I have no intention of building a GUI application with C if I don’t have to.

I am now buiding small apps that use the API and discovering the features that are needed but I didn’t think of before.

Everyone who develops software using free software libraries should take moment to thank the developers for thier time and hard work. Developing a sane API is hard.

Linux QoS API

My wrapper library for the Linux QoS system is coming along nicely. Here are the function calls necessary to add a filter that matches the destination field in the IP header.

filt = classifier_u32_new();
classifier_u32_set_class(filt, class);
classifier_u32_set_priority(filt, 5);
classifier_u32_set_protocol(filt, IP);
classifier_u32_set_interface(filt, 3);
classifier_u32_add_match_ip_dst(filt, "x.x.x.x");
if (!qos_classifier_u32_add(con, filt)) {
	g_print("Adding filter failed.n");
}

I am now trying to figure out how to handle the representation of the currently installed filters and classes in the API. Somehow the application needs a represenation of these things so it can make changes. Since the structure of the qeueing disciplines, classes and filters is very much like a tree I think this may be the best way to go.

Emacs source code navigation

Recently I have been spending a lot of time with a large amount of unfamiliar C code. Navigating a code base that is unfamiliar can be quite a challenge so I went on a search for useful Emacs features to make it easier.

The most useful tool I have found is etags. With etags you can quickly jump to the source file where a function is defined. If the source file is not already open in a buffer Emacs will open it for you. First you need to generate a TAGS file. To create a TAGS file run

find . -name '*.[ch]' | xargs etags

in the top directory of the source tree. Now start Emacs. M-x visit-tags-table will prompt you for the location of the tags file. Emacs now knows the name and location of all function definitions in the source tree. To jump to a function use M-. (that’s Meta-Period) and type the name of the function. If you simply press enter Emacs will jump to the function declaration that matches the word under the cursor. Very nice. As useful as this feature is it would still be very annoying if you couldn’t easily move back to where you jumped from. To jump backwards use M-*.

The etags system also gives you the ability to do auto-completion on function names that are in the TAGS file. Here is the necessary .emacs LISP code to bind this functionality to CTRL-Tab.

(add-hook 'c-mode-common-hook
        (lambda ()
                (define-key c-mode-map [(ctrl tab)] 'complete-tag)))

If you are a fan of long descriptive function names this is a very nice feature.

Finally, if you want to use etags with your own source tree you can add a Makefile target like this:

etags:
        find . -name '*.[ch]' | xargs etags

C lesson

Given:

struct mystruct myinstance;

Which is better?

sizeof(struct mystruct)
sizeof(myinstance)

Normally this doesn’t matter all that much. However, I believe the first is the better way. The reason for this is that if you use the instance variable in the sizeof you can later introduce a nasty bug should you decide that the instance should no longer exist on the stack. That is changing the first line to:

struct mystruct *myinstance;

The second form of sizeof() given above will now return the size of the pointer not the size of the structure. Boom. Nasty bug.

Subversion

My Linux QoS work has come to the point where I really need a revision control system. I normally use CVS but decided it was time to setup a Subversion repository. So far subversion is everything I expected, it’s just like CVS. When it comes to reorganizing the repository I’ll find out just how much better Subversion actually is.

The big bummer is that the current stable release of Emacs does not include Subversion support in VC-Mode. I love VC-Mode. I am not sure I can go back to coding without it. VC-Mode is so easy it encourages frequent commits. Having to run the svn command from the shell encourages the opposite.