Older blog entries for pjones (starting at number 137)

This is not 'Nam. This is C. There are rules.

I was going about my day earlier, when [info]spot sent me an IM asking for help with one of my favorite programs. Apparently, it was failing quite spectacularly on sparc, and he was having some trouble making the machine give useful debug data.

After a bit of hacking on it, I found this wonderful nugget:

int label_read(struct device *dev, struct label **result)
{
        char buf[LABEL_SIZE];
        struct labeller *l;
...
        if (!(l = _find_labeller(dev, buf, &sector)))
                goto_out;       
...
}
...
static struct labeller *_find_labeller(struct device *dev, char *buf,
                                       uint64_t *label_sector)
{
...
        struct label_header *lh;
...
        uint64_t sector;
        int found = 0;
        char readbuf[LABEL_SCAN_SIZE];

        if (!dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf)) {
                log_debug("%s: Failed to read label area", dev_name(dev));
                goto out;
        }

        /* Scan first few sectors for a valid label */
        for (sector = 0; sector < LABEL_SCAN_SECTORS;
             sector += LABEL_SIZE >> SECTOR_SHIFT) {
                lh = (struct label_header *) (readbuf +
                                              (sector << SECTOR_SHIFT));
...
                list_iterate_items(li, &_labellers) {
                        if (li->l->ops->can_handle(li->l, (char *) lh, sector)) {
...
}
Where li->l->ops->can_handle() winds up being...
static int _pool_read(struct labeller *l, struct device *dev, char *buf,
                 struct label **label)
{
        struct pool_list pl;

        return read_pool_label(&pl, l, dev, buf, label);
}
...
int read_pool_label(struct pool_list *pl, struct labeller *l,
                    struct device *dev, char *buf, struct label **label)
{               
...
        struct pool_disk *pd = &pl->pd;

        pool_label_in(pd, buf);
...
}
And elsewhere we find:
struct pool_disk {
        uint64_t pl_magic;      /* Pool magic number */
        uint64_t pl_pool_id;    /* Unique pool identifier */
        char pl_pool_name[POOL_NAME_SIZE];      /* Name of pool */
...
}
...
#define CPIN_64(x, y) {(x) = xlate64_be((y));}
...
void pool_label_in(struct pool_disk *pl, char *buf)
{
        struct pool_disk *bufpl = (struct pool_disk *) buf;

        CPIN_64(pl->pl_magic, bufpl->pl_magic);
        CPIN_64(pl->pl_pool_id, bufpl->pl_pool_id);
        CPIN_8(pl->pl_pool_name, bufpl->pl_pool_name, POOL_NAME_SIZE);
        CPIN_32(pl->pl_version, bufpl->pl_version);
...
}

Who wants to play "hunt the SIGBUS"?

Just think. Somebody was paid real money to write this. The mind boggles.

Syndicated 2006-11-29 21:42:13 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

My moment of Zen.

So, reading through some code today, I came across this bit:

pvh_dlocn_xl->offset = xlate64(UINT64_C(0));
pvh_dlocn_xl->size = xlate64(UINT64_C(0));

That is all.

Syndicated 2006-11-22 22:02:30 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

The whole Oracle thing...

Ok, so here's what I don't get. I keep seeing this quote from Edward Stevens, Oracle's CTO. He's CTO at a very, very large software company, so he must be a pretty smart guy, right? Here's the quote:

All we add are bug fixes, which are immediately available to Red Hat and the rest of the community.
Dear Mr. Stevens,

Do you not know the difference between the statement that you're making something available to a community, versus saying that you're contributing and being a part of a community? It seems like a pretty fundamental thing to me. I can only assume that you do understand the difference, and, as such, you chose your words carefully.

I admire your display of such courage, which is clearly required to admit so freely that you, and those you represent, don't intend to put forth serious contributions, nor to be a part of the community of which you speak.

That is all.

Syndicated 2006-10-27 04:35:14 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

ich bin ein papierklammerhalter

I was looking for a paperclip a few minutes ago, and couldn't find one.

When I asked my local coworkers, one of them immediately pointed out that somebody from facilities had brought by these little desktop trinkets, which we'd all dismissed as totally useless, but actually did contain paperclips.



We all have paperclips now.

Ich bin ein papierklatterhalter.

Sorry.

Syndicated 2006-09-06 14:49:38 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

the morning after


the morning after
Originally uploaded by atbash.
My friend Paul moved back to London this Friday (well, he flies today, which is Friday). I inherited some book shelves from him, which I picked up Wednesday evening, as the shelves weren't worth shipping overseas. So late Wednesday night, I rummaged around my apartment for all the books which weren't currently shelved (as you all know, this is usually at least a few dozen), and randomly tossed them onto the new shelving in my bedroom.

This is what I saw when I woke up this morning.

Syndicated 2006-09-01 05:52:46 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

OMFG.



This might be the best picture EVAR.

p.s. Sammy can't see this icon. At all. Awesome. Goddam colorblind motherfuckers.

p.p.s. this image is huge. I hate you all.

Syndicated 2006-08-19 06:36:13 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

fun with suspend and resume

Plenty of times I've suspended my laptop with my headphones on, while listening to music. Of course when I resumed, the music would still be playing. This is obviously not preffered.

So tonight I wrote some code to fix it. It's way more complicated than should be needed. Rhythmbox talks to dbus, but only to the session, not to the system. So the suspend/resume scripts can't talk to it[1]. So, since the obvious 5 line shell script won't work, I had to write a rhythmbox plugin that listens on dbus, and then make the shell script talk to that.

Rhythmbox's python binding method is pretty much backwards from what you'd expect, and it registers itself through an __init__ method call, rather than the obvious way. That's a little weird at first, but using dbus's python bindings are like trying to stab yourself in the foot with a rubber ball. The introspection methods are entirely useless (actually, they don't provide any introspection at all).

So, anyway, here's a tarball. I'll look at packaging it somewhere later.



[1] We should really make some infrastructure to fix this recurring problem...

Syndicated 2006-07-29 05:38:12 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

Why does reality seem to differ from person to person?

I am so there. Trailers are here.

Syndicated 2006-07-01 19:04:35 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

I just couldn't help myself...

So, I just updated our "pykickstart" package to handle configuration of multipath devices -- disks with redundant cabling. Don't ask why. Just as I was about to commit it, the best changelog entry ever sprung to mind:

Leeloo: Leeloo Dallas mul-ti-path.
Korben Dallas: Yeah.
Leeloo: Mul-ti-path.
Korben Dallas: Yeah, multipath, she knows it's a multipath. Leeloo Dallas. This is my wife.
Leeloo: Mul-ti-path.
Korben Dallas: We're newlyweds. Just met. You know how it is. We bumped into each other, sparks happen...
Leeloo: Mul-ti-path.
Korben Dallas: Yes, she knows it's a multipath. Anyway, we're in love.
Sometimes, I kill me.

Syndicated 2006-05-17 18:43:09 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

128 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!