Re: [systemd-devel] libudev: subdirectories in sysfs

2015-11-17 Thread David Herrmann
Hi

On Mon, Nov 16, 2015 at 5:35 PM, Anne Mulhern  wrote:
> Hi!
>
> libudev has some cooperating procedures that return the keys for a bunch of 
> sysfs attributes for a given device.
>
> These attributes all correspond to files that are stored in the sysfs device 
> directory.
>
> In the same directory there are sometimes subdirectories, that themselves 
> contain files
> with information about their corresponding attribute. The dm directory is one 
> obvious
> example.
>
> Are their any plans for libudev to add an ability to get the values from 
> these subdirectories
> as some kind of attributes?
>
> If no, why?

sd_device_get_sysattr_value(device, "foo/bar/baz", );

This should work fine (or its udev_device_* equivalent).

Btw., I recommend just using readdir(), open(), read(), and write().
sysfs is a filesystem, no reason to wrap all those commands.

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


Re: [systemd-devel] libudev: subdirectories in sysfs (what does "available" mean?)

2015-11-17 Thread Anne Mulhern




- Original Message -
> From: "David Herrmann" 
> To: "Anne Mulhern" 
> Cc: "systemd" 
> Sent: Tuesday, November 17, 2015 10:48:19 AM
> Subject: Re: [systemd-devel] libudev: subdirectories in sysfs
> 
> Hi
> 
> On Mon, Nov 16, 2015 at 5:35 PM, Anne Mulhern  wrote:
> > Hi!
> >
> > libudev has some cooperating procedures that return the keys for a bunch of
> > sysfs attributes for a given device.
> >
> > These attributes all correspond to files that are stored in the sysfs
> > device directory.
> >
> > In the same directory there are sometimes subdirectories, that themselves
> > contain files
> > with information about their corresponding attribute. The dm directory is
> > one obvious
> > example.
> >
> > Are their any plans for libudev to add an ability to get the values from
> > these subdirectories
> > as some kind of attributes?
> >
> > If no, why?
> 
> sd_device_get_sysattr_value(device, "foo/bar/baz", );
> 
> This should work fine (or its udev_device_* equivalent).
> 
> Btw., I recommend just using readdir(), open(), read(), and write().
> sysfs is a filesystem, no reason to wrap all those commands.
> 
> Thanks
> David
> 

Thanks, I'm asking this more as the pyudev maintainer than as someone
who actually wants these values.

The funny thing is, I recently found out that the list obtained by
udev_device_get_sysattr_list_entry () and friends contains so
called "available" keys, but when those get passed to 
udev_device_get_sysattr_value () the result might be NULL.
That makes sense in the sense that they might represent files
that are unreadable. 

Now I find out that I can make up keys not in the results of
udev_device_get_sysattr_list_entry () and pass those to
udev_device_get_sysattr_value() and get a non-null result.

So, what does "available" mean? Do these sysattr_list_entry()
methods give any useful information?

- mulhern

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


[systemd-devel] Udev development questions

2015-11-17 Thread Marek
Hi,

I'd like to ask a couple of questions:
1. Does udev store its list as a simple single or double linked list
or key value database? Does udev store it on disk or in memory?
2. Where can I find description of subsystem devtype string values?
struct udev_device * udev_device_get_parent_with_subsystem_devtype

(struct
udev_device *udev_device,
 const char *subsystem,
 const char *devtype);

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


Re: [systemd-devel] Udev development questions

2015-11-17 Thread Greg KH
On Wed, Nov 18, 2015 at 12:37:17AM +0100, Marek wrote:
> Hi,
> 
> I'd like to ask a couple of questions:
> 1. Does udev store its list as a simple single or double linked list
> or key value database? Does udev store it on disk or in memory?

The internals of udev shouldn't matter to any external user of the
library.

> 2. Where can I find description of subsystem devtype string values?

That depends on the kernel itself, it has nothing to do with udev, these
are values it provides.

thanks,

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


[systemd-devel] Fwd: Udev development questions

2015-11-17 Thread Marek
Why shouldn't they matter? Can you clarify? Where does the kernel
provide these values? Are they documented
somewhere or is there a way to look them up?

On Wed, Nov 18, 2015 at 12:45 AM, Greg KH  wrote:
> On Wed, Nov 18, 2015 at 12:37:17AM +0100, Marek wrote:
>> Hi,
>>
>> I'd like to ask a couple of questions:
>> 1. Does udev store its list as a simple single or double linked list
>> or key value database? Does udev store it on disk or in memory?
>
> The internals of udev shouldn't matter to any external user of the
> library.
>
>> 2. Where can I find description of subsystem devtype string values?
>
> That depends on the kernel itself, it has nothing to do with udev, these
> are values it provides.
>
> thanks,
>
> greg k-h
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] about systemd-logind

2015-11-17 Thread Mantas Mikulėnas
On Wed, Nov 18, 2015 at 9:07 AM, yan...@iscas.ac.cn 
wrote:

> Hi,when I  do like this "logindctl list session ",it tell me 0 sessions
> listed. The reasion I will  do this is that my nm-connection-editor can not
> add or modify  with administor ,and   if I do not have an active session
> with systemd-logind. So  does this related systemd-logind?
>

You need to have pam_systemd.so in your PAM configuration.

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] making persistent tmpfs folders with systemd

2015-11-17 Thread bobafetthotmail



On 11/17/2015 02:34 PM, Lennart Poettering wrote:

On Mon, 16.11.15 18:50, bobafetthotmail (starshipele...@hotmail.it) wrote:


I have a script that allows me to |mount| a folder to |tmpfs|, while
bind-mounting the same folder to another location, so I can sync the
contents (on startup, shutdown, and when needed) between the |tmpfs| and the
original folder on system drive.

I use it for folders that see many writes, but whose data should be
preserved after a reboot.

Mostly to use a USB flash drive or SD card as system drive, while running
programs that aggressively write round-robin databases or similar
small-size-high-write files.


Sooo. I was wondering if systemd allows me to do something like that
natively.

I did look at the tmpfs modules of systemd, but from what I understood it
does deal with making non-persistent tmpfs on the fly, clean temporary files
from a folder and so on.

Is there a persistency option I did miss perhaps?

No, there is not. And I don't really see this a strong enough usecase
to make it something native.

Sorry.

Lennart



Thanks for the answer. :)

No need to be sorry, my question was a sanity check.

Now I can go and make a systemd module calling my script without fear of 
being called noob.


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


[systemd-devel] about systemd-logind

2015-11-17 Thread yan...@iscas.ac.cn
Hi,when I  do like this "logindctl list session ",it tell me 0 sessions listed. 
The reasion I will  do this is that my nm-connection-editor can not add or 
modify  with administor ,and   if I do not have an active session with 
systemd-logind. So  does this related systemd-logind?




yan...@iscas.ac.cn
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel