[systemd-devel] libudev: subdirectories in sysfs

2015-11-16 Thread Anne Mulhern
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?

Thanks!

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


Re: [systemd-devel] [packaging] split of systemd package

2015-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Nov 16, 2015 at 09:37:41AM +0100, Lukáš Nykrýn wrote:
> Zbigniew Jędrzejewski-Szmek píše v So 14. 11. 2015 v 02:14 +:
> > Hi,
> > 
> > implementing the split in Fedora deserves a Changes page,
> > because of the need to coordinate with other components of the
> > distribution (comps, some packages, anaconda):
> > https://fedoraproject.org/wiki/Changes/systemd_package_split
> > 
> > All the details are described on the Change page. If anything
> > is missing/unclear, please let me know.
> 
> Hi,
> I'm not currently near my laptop so I can't test it, but how are the
> virtualization tools working without machined installed?

Do you mean virsh and similar? virsh should function, but some
functionality would not be available [1]. Not sure about
golang-github-coreos-go-systemd or lxc. I think that those packages
should get an explicit dependency on -container. I'm not aware of
other users.

Zbyszek

[1] http://sources.debian.net/src/libvirt/1.2.21-1/src/util/virsystemd.c/#L248
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] making persistent tmpfs folders with systemd

2015-11-16 Thread bobafetthotmail
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?


-Albert


___
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-16 Thread Reindl Harald


Am 16.11.2015 um 18:50 schrieb bobafetthotmail:

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?


what do yu need from systemd in that context?

/etc/fstab:
tmpfs  /var/lib/spamass-milter/.spamassassin  tmpfs 
defaults,noexec,nosuid,noatime,size=1024m,uid=189,gid=188,mode=0700


/etc/systemd/system/bayes.service:
[Unit]
Description=Bayes RAM-Disk Manager
Before=spamassassin.service

[Service]
Type=oneshot
RemainAfterExit=yes
User=sa-milt
Group=sa-milt
ExecStart=/usr/bin/rsync --quiet --recursive --times 
/var/lib/bayes-persistent/ /var/lib/spamass-milter/.spamassassin/
ExecStop=/usr/bin/rsync --quiet --recursive --times 
/var/lib/spamass-milter/.spamassassin/ /var/lib/bayes-persistent/





signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCHv4] Read Dell Server NIC partition IDs

2015-11-16 Thread systemd github import bot
Patchset imported to github.
To create a pull request, one of the main developers has to initiate one via:


--
Generated by https://github.com/haraldh/mail2git
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCHv4] Read Dell Server NIC partition IDs

2015-11-16 Thread jharg93
From: Jordan Hargrave 

Removed SMBIOS specific code and cleaned up linux coding style.

This patch will read the PCI VPD area to detect the physical port
and partition for NICs on Dell Servers.  It creates a new
environment variable of the form
ID_NET_NAME_PARTITION=_

Signed-off-by: Jordan Hargrave 
---
 src/udev/udev-builtin-net_id.c | 130 +
 1 file changed, 130 insertions(+)

diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index ef9c398..affbbf1 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -119,16 +119,130 @@ struct netnames {
 bool mac_valid;
 
 struct udev_device *pcidev;
+struct udev_device *physdev;
 char pci_slot[IFNAMSIZ];
 char pci_path[IFNAMSIZ];
 char pci_onboard[IFNAMSIZ];
 const char *pci_onboard_label;
+int  npar_port;
+int  npar_pfi;
 
 char usb_ports[IFNAMSIZ];
 char bcma_core[IFNAMSIZ];
 char ccw_group[IFNAMSIZ];
 };
 
+#define FLAG_IOV 0x80
+#define FLAG_NPAR 0x1000
+
+#define VPDI_TAG 0x82
+#define VPDR_TAG 0x90
+
+struct vpd_tag {
+char  cc[2];
+unsigned char len;
+char  data[1];
+};
+
+/* Read VPD tag ID */
+static int vpd_readtag(int fd, int *len)
+{
+unsigned char tag, tlen[2];
+
+if (read(fd, , 1) != 1)
+return -1;
+if (tag == 0x00 || tag == 0xFF || tag == 0x7F)
+return -1;
+if (tag & 0x80) {
+if (read(fd, tlen, 2) != 2)
+return -1;
+*len = tlen[0] + (tlen[1] << 8);
+return tag;
+}
+*len = (tag & 0x7);
+return (tag & ~0x7);
+}
+
+static void *vpd_findtag(void *buf, int len, const char *sig)
+{
+int off, siglen;
+struct vpd_tag *t;
+
+off = 0;
+siglen = strlen(sig);
+while (off < len) {
+t = (struct vpd_tag *)((unsigned char *)buf + off);
+if (!memcmp(t->data, sig, siglen))
+return t;
+off += (t->len + 3);
+}
+return NULL;
+}
+
+static void dev_pci_npar_dcm(struct udev_device *dev, struct netnames *names,
+ int len, const char *dcm,
+ const char *fmt, int step)
+{
+int domain, bus, slot, func, off, mydf;
+int port, df, pfi, flag;
+
+if (sscanf(udev_device_get_sysname(names->physdev), "%x:%x:%x.%u",
+   , , , ) != 4)
+return;
+mydf = (slot << 3) + func;
+for (off = 3; off < len; off += step) {
+if (sscanf(dcm+off, fmt, , , , ) != 4)
+break;
+if ((flag & FLAG_NPAR) && mydf == df) {
+names->npar_port = port;
+names->npar_pfi = pfi;
+}
+}
+}
+
+static void dev_pci_npar(struct udev_device *dev, struct netnames *names)
+{
+const char *filename;
+int len, fd;
+struct vpd_tag *dcm;
+void *buf;
+
+/* Search for VPD or IOV VPD */
+filename = strjoina(udev_device_get_syspath(names->physdev), "/vpd");
+fd = open(filename, O_RDONLY);
+if (fd < 0)
+return;
+if (vpd_readtag(fd, ) != VPDI_TAG)
+goto done;
+lseek(fd, len, SEEK_CUR);
+
+/* Check VPD-R */
+if (vpd_readtag(fd, ) != VPDR_TAG)
+goto done;
+buf = alloca(len);
+if (read(fd, buf, len) != len)
+goto done;
+
+/* Check for DELL VPD tag */
+if (!vpd_findtag(buf, len, "DSV1028VPDR.VER"))
+goto done;
+
+/* Find DCM/DC2 tag */
+dcm = vpd_findtag(buf, len, "DCM");
+if (dcm != NULL)
+dev_pci_npar_dcm(dev, names, dcm->len, dcm->data,
+ "%1x%1x%2x%6x", 10);
+else {
+dcm = vpd_findtag(buf, len, "DC2");
+if (dcm != NULL)
+dev_pci_npar_dcm(dev, names, dcm->len, dcm->data,
+ "%1x%2x%2x%6x", 11);
+}
+ done:
+close(fd);
+return;
+}
+
 /* retrieve on-board index number and label from firmware */
 static int dev_pci_onboard(struct udev_device *dev, struct netnames *names) {
 unsigned dev_port = 0;
@@ -277,6 +391,8 @@ out:
 
 static int names_pci(struct udev_device *dev, struct netnames *names) {
 struct udev_device *parent;
+struct udev *udev;
+char path[256];
 
 assert(dev);
 assert(names);
@@ -301,8 +417,15 @@ static int names_pci(struct udev_device *dev, struct 
netnames *names) {
 if (!names->pcidev)
 return -ENOENT;
 }
+/* find 

Re: [systemd-devel] Scheme bindings

2015-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Nov 13, 2015 at 09:27:17AM +0100, Jan Synáček wrote:
> Hello,
> 
> if anybody lurking here and hacking on systemd also likes scheme, I
> created bindings for GNU Guile [1]. The API is far from covered, but
> journal API and sd_listen* stuff is usable. You can now write socket
> activated services in scheme!
> 
> [1] https://github.com/jsynacek/guile-systemd

Hi,

when you construct a list like this, do you have normal or reverse order:
for (i = 0; i < r; i++)
   s_fds = scm_cons(scm_from_int(SD_LISTEN_FDS_START+i), s_fds);
?

return sd_booted() ? SCM_BOOL_T : SCM_BOOL_F;
→ sd_booted can return negative for error.


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


Re: [systemd-devel] Scheme bindings

2015-11-16 Thread David Timothy Strauss
Would you be interested in moving this work to the systemd umbrella project
on GitHub? You would still manage the team, but it may get more visibility.

On Fri, Nov 13, 2015, 19:27 Jan Synáček  wrote:

> Hello,
>
> if anybody lurking here and hacking on systemd also likes scheme, I
> created bindings for GNU Guile [1]. The API is far from covered, but
> journal API and sd_listen* stuff is usable. You can now write socket
> activated services in scheme!
>
> [1] https://github.com/jsynacek/guile-systemd
>
> Have fun,
> --
> Jan Synacek
> Software Engineer, Red Hat
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] about the daemon

2015-11-16 Thread yan...@iscas.ac.cn
Because Systemd create the socket for the service,so what I want to know is 
when I  use a daemon , I will get the source  of the daemon and modyfy 
it,right?   



yan...@iscas.ac.cn
 
From: Martin Pitt
Date: 2015-11-17 13:57
To: yan...@iscas.ac.cn
CC: systemd-devel
Subject: Re: [systemd-devel] about the daemon
Hello yankun,
 
yan...@iscas.ac.cn [2015-11-17 13:40 +0800]:
> If I want to use the systemd,I will rewrite the daemon under the 
> systemd,right?
 
Sorry, this question is not understandable. Can you please explain
your question in a more detailled way?
 
Martin
 
-- 
Martin Pitt| http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [packaging] split of systemd package

2015-11-16 Thread Lukáš Nykrýn
Zbigniew Jędrzejewski-Szmek píše v So 14. 11. 2015 v 02:14 +:
> Hi,
> 
> implementing the split in Fedora deserves a Changes page,
> because of the need to coordinate with other components of the
> distribution (comps, some packages, anaconda):
> https://fedoraproject.org/wiki/Changes/systemd_package_split
> 
> All the details are described on the Change page. If anything
> is missing/unclear, please let me know.

Hi,
I'm not currently near my laptop so I can't test it, but how are the
virtualization tools working without machined installed?

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


[systemd-devel] about the network

2015-11-16 Thread yan...@iscas.ac.cn

hey, when I install the ubuntu's systemd(I mean  deb package ),when I use  root 
to log ,I can use the nm-connect-edit,but when i use  a normal account (sam),I 
can not use the nm-connect-edit,I mean I can open it ,but i can not add some 
configure  parametric.I donot install the systemd-ui .can some one help me .I 
use  linux-mint17


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


Re: [systemd-devel] about the network

2015-11-16 Thread Lennart Poettering
On Mon, 16.11.15 18:22, yan...@iscas.ac.cn (yan...@iscas.ac.cn) wrote:

> 
> hey, when I install the ubuntu's systemd(I mean deb package ),when I
> use root to log ,I can use the nm-connect-edit,but when i use a
> normal account (sam),I can not use the nm-connect-edit,I mean I can
> open it ,but i can not add some configure parametric.I donot install
> the systemd-ui .can some one help me .I use linux-mint17

systemd is not involved in NetworkManager or anything like it. Please
ask your distribution for help.

Lennart

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