Skip to content

Commit

Permalink
prefix all functions with kdbus_
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldh authored and kaysievers committed Jun 5, 2013
1 parent d59e18a commit b5d9a58
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Internal:
- update/rethink kdbus_conn_accounting_sub_size() use, we don't allocate
kernel memory anymore
- memfd's file pos is shared, which can be confusing, document pread/pwrite
- prefix all functions with kdbus_
- conn->ep->bus ==> conn->bus

Kernel Core:
Expand Down
14 changes: 7 additions & 7 deletions connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ static int kdbus_conn_memfd_ref(const struct kdbus_item *item,

/* We only accept kdbus_memfd files as payload, other files need to
* be passed with KDBUS_MSG_FDS. */
if (!is_kdbus_memfd(fp)) {
if (!kdbus_is_memfd(fp)) {
ret = -EMEDIUMTYPE;
goto exit_unref;
}

/* We only accept a sealed memfd file whose content cannot be altered
* by the sender or anybody else while it is shared or in-flight. */
if (!is_kdbus_memfd_sealed(fp)) {
if (!kdbus_is_memfd_sealed(fp)) {
ret = -ETXTBSY;
goto exit_unref;
}
Expand Down Expand Up @@ -1003,7 +1003,7 @@ static int kdbus_conn_release(struct inode *inode, struct file *file)
return 0;
}

static bool check_flags(u64 kernel_flags)
static bool kdbus_check_flags(u64 kernel_flags)
{
/* The higher 32bit are considered 'incompatible
* flags'. Refuse them all for now */
Expand Down Expand Up @@ -1035,7 +1035,7 @@ static long kdbus_conn_ioctl_control(struct file *file, unsigned int cmd,
if (ret < 0)
break;

if (!check_flags(bus_kmake->make.flags)) {
if (!kdbus_check_flags(bus_kmake->make.flags)) {
ret = -ENOTSUPP;
break;
}
Expand Down Expand Up @@ -1068,7 +1068,7 @@ static long kdbus_conn_ioctl_control(struct file *file, unsigned int cmd,
if (ret < 0)
break;

if (!check_flags(ns_kmake->make.flags)) {
if (!kdbus_check_flags(ns_kmake->make.flags)) {
ret = -ENOTSUPP;
break;
}
Expand Down Expand Up @@ -1132,7 +1132,7 @@ static long kdbus_conn_ioctl_ep(struct file *file, unsigned int cmd,
if (ret < 0)
break;

if (!check_flags(kmake->make.flags)) {
if (!kdbus_check_flags(kmake->make.flags)) {
ret = -ENOTSUPP;
break;
}
Expand Down Expand Up @@ -1180,7 +1180,7 @@ static long kdbus_conn_ioctl_ep(struct file *file, unsigned int cmd,
}
hello = v;

if (!check_flags(hello->conn_flags)) {
if (!kdbus_check_flags(hello->conn_flags)) {
ret = -ENOTSUPP;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions memfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ struct kdbus_memfile {
struct file *fp;
};

bool is_kdbus_memfd(const struct file *fp)
bool kdbus_is_memfd(const struct file *fp)
{
return fp->f_op == &kdbus_memfd_fops;
}

bool is_kdbus_memfd_sealed(const struct file *fp)
bool kdbus_is_memfd_sealed(const struct file *fp)
{
struct kdbus_memfile *mf = fp->private_data;
bool sealed;
Expand Down
4 changes: 2 additions & 2 deletions memfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include "internal.h"

bool is_kdbus_memfd(const struct file *fp);
bool is_kdbus_memfd_sealed(const struct file *fp);
bool kdbus_is_memfd(const struct file *fp);
bool kdbus_is_memfd_sealed(const struct file *fp);
u64 kdbus_memfd_size(const struct file *fp);
int kdbus_memfd_new(int *fd);
#endif
14 changes: 7 additions & 7 deletions policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ struct kdbus_policy_db *kdbus_policy_db_new(void)
return db;
}

static inline u64 collect_entry_accesses(struct kdbus_policy_db_entry *db_entry,
static inline u64 kdbus_collect_entry_accesses(struct kdbus_policy_db_entry *db_entry,
struct kdbus_conn *conn)
{
struct kdbus_policy_db_entry_access *a;
Expand Down Expand Up @@ -208,7 +208,7 @@ static int __kdbus_policy_db_check_send_access(struct kdbus_policy_db *db,
if (strcmp(db_entry->name, name_entry->name) != 0)
continue;

access = collect_entry_accesses(db_entry, conn_src);
access = kdbus_collect_entry_accesses(db_entry, conn_src);
if (access & KDBUS_POLICY_SEND)
return 0;
}
Expand All @@ -220,7 +220,7 @@ static int __kdbus_policy_db_check_send_access(struct kdbus_policy_db *db,
if (strcmp(db_entry->name, name_entry->name) != 0)
continue;

access = collect_entry_accesses(db_entry, conn_dst);
access = kdbus_collect_entry_accesses(db_entry, conn_dst);
if (access & KDBUS_POLICY_RECV)
return 0;
}
Expand All @@ -246,7 +246,7 @@ kdbus_policy_cache_entry_new(struct kdbus_conn *conn_a,
return ce;
}

static int add_reverse_cache_entry(struct kdbus_policy_db *db,
static int kdbus_add_reverse_cache_entry(struct kdbus_policy_db *db,
struct kdbus_policy_db_cache_entry *ce,
u64 reply_deadline_ns)
{
Expand Down Expand Up @@ -291,7 +291,7 @@ int kdbus_policy_db_check_send_access(struct kdbus_policy_db *db,
mutex_unlock(&db->cache_lock);
/* do we need a temporaty rule for replies? */
if (reply_deadline_ns)
ret = add_reverse_cache_entry(db, ce, reply_deadline_ns);
ret = kdbus_add_reverse_cache_entry(db, ce, reply_deadline_ns);
return ret;
}
mutex_unlock(&db->cache_lock);
Expand All @@ -312,7 +312,7 @@ int kdbus_policy_db_check_send_access(struct kdbus_policy_db *db,

/* do we need a temporaty rule for replies? */
if (reply_deadline_ns)
ret = add_reverse_cache_entry(db, ce, reply_deadline_ns);
ret = kdbus_add_reverse_cache_entry(db, ce, reply_deadline_ns);
}

exit_unlock_entries:
Expand Down Expand Up @@ -354,7 +354,7 @@ int kdbus_policy_db_check_own_access(struct kdbus_policy_db *db,
if (strcmp(db_entry->name, name) != 0)
continue;

access = collect_entry_accesses(db_entry, conn);
access = kdbus_collect_entry_accesses(db_entry, conn);
if (access & KDBUS_POLICY_OWN) {
ret = 0;
goto exit_unlock;
Expand Down

0 comments on commit b5d9a58

Please sign in to comment.