Re: [systemd-devel] About autofs: no handling of expire??

2012-05-02 Thread Lennart Poettering
On Wed, 02.05.12 07:45, Stef Bon (stef...@gmail.com) wrote:

 Hi,
 
 I've been looking into the code how systemd handles the automounting.

Heya,

 I've got two issues:
 
 a. I've found the handling of the missing packet
 (autofs_ptype_missing_direct), which triggers the
 mounting. But I did not found the handling of the expire packet
 (autofs_ptype_expire_direct). Is this on purpose?
 I see a timeout set, so I guess it was the intention to handle the
 expire.

We currently don't do expiration, since this wasn't intended as a full
autofs implementation, but just a way to parallelize and delay load
things at boot.

That said, we could support expire easily I guess, and so I have now
added this to the TODO list.

 b. the packet read from the pipe is of type union
 autofs_v5_packet_union which looks like:
 
 union autofs_v5_packet_union {
 struct autofs_packet_hdr hdr;
 struct autofs_v5_packet v5_packet;
 autofs_packet_missing_indirect_t missing_indirect;
 autofs_packet_expire_indirect_t expire_indirect;
 autofs_packet_missing_direct_t missing_direct;
 autofs_packet_expire_direct_t expire_direct;
 };
 
 where autofs_v5_packet is:
 
 struct autofs_v5_packet {
 struct autofs_packet_hdr hdr;
 autofs_wqt_t wait_queue_token;
 __u32 dev;
 __u64 ino;
 __u32 uid;
 __u32 gid;
 __u32 pid;
 __u32 tgid;
 __u32 len;
 char name[NAME_MAX+1];
 };
 
 now in the code of automount_fd_event, the selection is based upon
 packet.hdr.type, and futher the fields
 packet.v5_packet.pid are used. Now this while packet is an union: it's
 used as hdr OR as autofs_v5_packet, not both at the same time.
 It works, so here probably happens something strange: while using the
 field packet.hdr, actually the field packet.v5_packet.hdr is used. Is
 this correct?

In Autofs5 all packets have the same format which exposes
pid. i.e. autofs_packet_xxx_yyy_t are all typedef'ed to the same packet
struct. Hence accessing this this way is safe.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] About autofs: no handling of expire??

2012-05-02 Thread Stef Bon
2012/5/2 Lennart Poettering lenn...@poettering.net:
 (autofs_ptype_expire_direct). Is this on purpose?
 I see a timeout set, so I guess it was the intention to handle the
 expire.

 We currently don't do expiration, since this wasn't intended as a full
 autofs implementation, but just a way to parallelize and delay load
 things at boot.

 That said, we could support expire easily I guess, and so I have now
 added this to the TODO list.

Well you do not have to. I'm just asking.

 It works, so here probably happens something strange: while using the
 field packet.hdr, actually the field packet.v5_packet.hdr is used. Is
 this correct?

 In Autofs5 all packets have the same format which exposes
 pid. i.e. autofs_packet_xxx_yyy_t are all typedef'ed to the same packet
 struct. Hence accessing this this way is safe.

Well yes every autofs packet starts with a header. If it's a autofsv5
pakket, it also starts with a header. Probably because it's the first
struct in the union AND the first field part of autofs_v5_packet, it
works.

I'm just checking the code and see I understand it to write my own
autofs implementation using FUSE. The FUSE fs will somehow be what now
is the browseable map with indirect maps with the automounter, and
somehow  I have to find a way to make a specific directory a direct
autofs mountpoint.

Thanks,

Stef Bon
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] About autofs: no handling of expire??

2012-05-01 Thread Stef Bon
Hi,

I've been looking into the code how systemd handles the automounting.

I've got two issues:

a. I've found the handling of the missing packet
(autofs_ptype_missing_direct), which triggers the
mounting. But I did not found the handling of the expire packet
(autofs_ptype_expire_direct). Is this on purpose?
I see a timeout set, so I guess it was the intention to handle the expire.

b. the packet read from the pipe is of type union
autofs_v5_packet_union which looks like:

union autofs_v5_packet_union {
struct autofs_packet_hdr hdr;
struct autofs_v5_packet v5_packet;
autofs_packet_missing_indirect_t missing_indirect;
autofs_packet_expire_indirect_t expire_indirect;
autofs_packet_missing_direct_t missing_direct;
autofs_packet_expire_direct_t expire_direct;
};

where autofs_v5_packet is:

struct autofs_v5_packet {
struct autofs_packet_hdr hdr;
autofs_wqt_t wait_queue_token;
__u32 dev;
__u64 ino;
__u32 uid;
__u32 gid;
__u32 pid;
__u32 tgid;
__u32 len;
char name[NAME_MAX+1];
};

now in the code of automount_fd_event, the selection is based upon
packet.hdr.type, and futher the fields
packet.v5_packet.pid are used. Now this while packet is an union: it's
used as hdr OR as autofs_v5_packet, not both at the same time.
It works, so here probably happens something strange: while using the
field packet.hdr, actually the field packet.v5_packet.hdr is used. Is
this correct?

Stef
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel