From: Anton Korenyushkin Subject: Re: xenbus_mkdir("/tools", "name") fails Date: Wed, 28 Sep 2005 17:07:08 +0400 Message-ID: <200509281707.08311.tiger@swsoft.mipt.ru> References: <200509272236.22270.tiger@swsoft.mipt.ru> <5d7aca9505092720474490b62a@mail.gmail.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_8VpODM2oYj73xG6" Return-path: In-Reply-To: <5d7aca9505092720474490b62a@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: NAHieu Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --Boundary-00=_8VpODM2oYj73xG6 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wednesday 28 September 2005 07:47, NAHieu wrote: > On 9/28/05, Anton Korenyushkin wrote: > > Hi, > > > > I wrote subj in my module and i get instant reboot after calling this > > function. It doesn't depend on were xenstored started or not. > > I guess something wrong with your code. I wrote some kernel code uses > xenbus, and see no problem. > > Why dont you post your code here and let people comment on it? > > Hieu > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel I have attached module's code. There are a lot of proc fs stuff in it, xenbus_mkdir is called when root writes something into /proc/xen/prmigr. I execute commands xend start && echo 'hi' >/proc/xen/prmigr. And then i get reboot. -- Best regards, Anton Korenyushkin mailto:tiger@swsoft.mipt.ru --Boundary-00=_8VpODM2oYj73xG6 Content-Type: text/x-csrc; charset="iso-8859-1"; name="prmigr_back.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="prmigr_back.c" /****************************************************************************** * prmigr_back.c * * XenLinux process migration tool * * Copyright (c) 2005 Anton Korenyushkin tiger@swsoft.mipt.ru */ #include #include #include #include #include #include #include #define PRMIGR_PROC_FNAME "prmigr" #define PRMIGR_DIR "/tools" /* proc file system stuff */ static struct proc_dir_entry *prmigr_proc_file; static ssize_t prmigr_input(struct file *filp, const char *buff, size_t len, loff_t * off) { int err; err = xenbus_mkdir(PRMIGR_DIR, "prmigr"); if (err) printk(">>>prmigr_back: mkdir failed with %d\n", err); else printk(">>>prmigr_back: mkdir succeded\n"); return len; } static int prmigr_permission(struct inode *inode, int op, struct nameidata *foo) { if (op == 2 && current->euid == 0) return 0; return -EACCES; } int prmigr_open(struct inode *inode, struct file *file) { try_module_get(THIS_MODULE); return 0; } int prmigr_close(struct inode *inode, struct file *file) { module_put(THIS_MODULE); return 0; /* success */ } static struct file_operations prmigr_fops = { .write = prmigr_input, .open = prmigr_open, .release = prmigr_close, }; static struct inode_operations prmigr_iops = { .permission = prmigr_permission, }; /* Initialisation stuff */ static int __init prmigr_back_init(void) { int ret = 0; prmigr_proc_file = create_xen_proc_entry(PRMIGR_PROC_FNAME, 0200); prmigr_proc_file->owner = THIS_MODULE; prmigr_proc_file->proc_iops = &prmigr_iops; prmigr_proc_file->proc_fops = &prmigr_fops; prmigr_proc_file->mode = S_IWUSR; prmigr_proc_file->uid = 0; prmigr_proc_file->gid = 0; prmigr_proc_file->size = 0; if (prmigr_proc_file == NULL) { ret = -ENOMEM; remove_xen_proc_entry(PRMIGR_PROC_FNAME); /* FIXME */ printk(KERN_INFO "Error: Could not initialize %s/%s", "/proc/xen", PRMIGR_PROC_FNAME); } return ret; } __initcall(prmigr_back_init); /* * Local variables: * c-file-style: "linux" * indent-tabs-mode: t * c-indent-level: 8 * c-basic-offset: 8 * tab-width: 8 * End: */ --Boundary-00=_8VpODM2oYj73xG6 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_8VpODM2oYj73xG6--