changeset: 22:d9636e8385d1
tag: tip
user: Dimitrios Papastamos <stateless [at] archlinux.us>
date: Sun Oct 04 02:11:12 2009 +0100
files: skvm.c
description:
reformatted the code.
diff -r 37f94265b4cc -r d9636e8385d1 skvm.c
--- a/skvm.c Sun Jun 21 14:08:17 2009 -0700
+++ b/skvm.c Sun Oct 04 02:11:12 2009 +0100
@@ -152,7 +152,8 @@
static void debug_dump_device(const struct device_t *device);
int
-main(int argc, char *argv[]) {
+main(int argc, char *argv[])
+{
int c;
static struct option long_options[] = {
@@ -192,7 +193,8 @@
}
static int
-init_skvm(void) {
+init_skvm(void)
+{
DBusError error;
dbus_error_init(&error);
@@ -209,7 +211,8 @@
}
static int
-init_dbus(DBusError *error) {
+init_dbus(DBusError *error)
+{
if (!(dbus_conn = dbus_bus_get(DBUS_BUS_SYSTEM, error)))
return -1;
dbus_connection_setup_with_g_main (dbus_conn, (GMainContext *)NULL);
@@ -218,7 +221,8 @@
}
static int
-init_hal(void) {
+init_hal(void)
+{
DBusError error;
if (!(hal_ctx = libhal_ctx_new()))
@@ -254,7 +258,8 @@
}
static void
-deinit(void) {
+deinit(void)
+{
struct device_t *iter, *tmp;
if (hal_ctx) {
@@ -286,7 +291,8 @@
/* Callback function, called when a new device has been inserted. */
static void
-device_added(LibHalContext *context, const char *did) {
+device_added(LibHalContext *context, const char *did)
+{
const char *dudi, *fstype;
char *dev, *mountp, *mountable, *label, *locked_reason;
LibHalVolume *volume;
@@ -361,7 +367,8 @@
/* Callback function, called when a device has been removed. */
static void
device_removed(LibHalContext *context __attribute__ ((unused)),
- const char *did) {
+ const char *did)
+{
char *mountp = NULL;
struct device_t *iter = head, *prev = NULL;
@@ -415,7 +422,8 @@
}
static void
-add_to_device_list(struct device_t *device) {
+add_to_device_list(struct device_t *device)
+{
if (!device)
return;
@@ -431,7 +439,8 @@
}
static void
-remove_from_device_list(struct device_t *prev, struct device_t *curr) {
+remove_from_device_list(struct device_t *prev, struct device_t *curr)
+{
if (!curr)
return;
@@ -450,7 +459,8 @@
}
static void
-free_device(struct device_t *device) {
+free_device(struct device_t *device)
+{
if (!device)
return;
@@ -470,7 +480,8 @@
}
static int
-is_mounted(const char *dev) {
+is_mounted(const char *dev)
+{
FILE *mtab;
struct mntent *entry;
@@ -490,7 +501,8 @@
}
static char *
-get_mount_point(const char *dev, const char *label) {
+get_mount_point(const char *dev, const char *label)
+{
const char *extra;
char *mountp, *dev_tmp;
size_t len;
@@ -529,7 +541,8 @@
* to a file whose path is defined relative to the symlink.
*/
static int
-resolve_symlink(const char *restrict symlnk, char *restrict d, size_t d_len) {
+resolve_symlink(const char *restrict symlnk, char *restrict d, size_t d_len)
+{
char file[d_len], buf[d_len];
ssize_t len;
size_t f_len = strlen(symlnk) + 1;
@@ -563,7 +576,8 @@
* not have a rule, the device is not altered.
*/
static void
-consider_fstab(struct device_t *device) {
+consider_fstab(struct device_t *device)
+{
FILE *fp, *mtab;
struct mntent *entry, *i;
char rlink[1024], *tmp, *str, *did;
@@ -632,7 +646,8 @@
}
static int
-do_mount(const struct device_t *device) {
+do_mount(const struct device_t *device)
+{
if (!device)
return -1;
@@ -650,7 +665,8 @@
}
static int
-do_umount(const struct device_t *device) {
+do_umount(const struct device_t *device)
+{
if (!device)
return -1;
@@ -661,7 +677,8 @@
}
static int
-add_fstab_entry(const struct device_t *device) {
+add_fstab_entry(const struct device_t *device)
+{
FILE *fstab;
struct mntent entry;
@@ -684,7 +701,8 @@
}
static int
-remove_fstab_entry(const struct device_t *device) {
+remove_fstab_entry(const struct device_t *device)
+{
FILE *fstab = NULL, *line_pp = NULL;
char buf[BUFSIZ];
int lines = 0, i = 0;
@@ -739,13 +757,15 @@
}
static inline int
-file_exists(const char *s) {
+file_exists(const char *s)
+{
struct stat sb;
return ((stat(s, &sb) < 0 && errno == ENOENT) ? -ENOENT : 0);
}
static void
-cleanup(int sig __attribute__ ((unused))) {
+cleanup(int sig __attribute__ ((unused)))
+{
g_main_loop_quit(loop);
}
@@ -754,7 +774,8 @@
* file has been opened and the new instance has been daemonized.
*/
static int
-is_running(void) {
+is_running(void)
+{
char buf[16];
int serrno;
@@ -781,7 +802,8 @@
}
static void
-debug_dump_device(const struct device_t *device) {
+debug_dump_device(const struct device_t *device)
+{
if (!device)
return;
Received on Sun Oct 04 2009 - 01:11:17 UTC
This archive was generated by hypermail 2.2.0 : Sun Oct 04 2009 - 01:12:05 UTC