mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org
Subject: [9/11] hugetlb: move inode attributes into hugetlb_key
Date: Tue, 12 Nov 2002 00:28:53 -0800	[thread overview]
Message-ID: <E18BWPl-0005KM-00@holomorphy> (raw)

This patch moves uid/gid/mode/size fields used in struct inode and the
checks on them into key management code and structures.

 hugetlbpage.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


diff -urpN htlb-2.5.47-8/arch/i386/mm/hugetlbpage.c htlb-2.5.47-9/arch/i386/mm/hugetlbpage.c
--- htlb-2.5.47-8/arch/i386/mm/hugetlbpage.c	2002-11-11 22:32:00.000000000 -0800
+++ htlb-2.5.47-9/arch/i386/mm/hugetlbpage.c	2002-11-11 22:42:23.000000000 -0800
@@ -33,6 +33,10 @@ struct hugetlb_key {
 	struct inode *in;
 	int key;
 	int busy;
+	uid_t uid;
+	gid_t gid;
+	umode_t mode;
+	loff_t size;
 };
 
 static struct hugetlb_key htlbpagek[MAX_ID];
@@ -63,7 +67,7 @@ static struct hugetlb_key *find_key(int 
 	return NULL;
 }
 
-static int check_size_prot(struct inode *inode, unsigned long len, int prot, int flag);
+static int check_size_prot(struct hugetlb_key *key, unsigned long len, int prot, int flag);
 /*
  * Call without htlbpage_lock, returns with htlbpage_lock held.
  */
@@ -105,6 +109,10 @@ struct hugetlb_key *alloc_key(int key, u
 						inode->i_gid = current->fsgid;
 						inode->i_mode = prot;
 						inode->i_size = len;
+						hugetlb_key->uid = current->fsuid;
+						hugetlb_key->gid = current->fsgid;
+						hugetlb_key->mode = prot;
+						hugetlb_key->size = len;
 						*new = 1;
 					}
 				}
@@ -112,7 +120,7 @@ struct hugetlb_key *alloc_key(int key, u
 		} else if (key_busy(hugetlb_key)) {
 			hugetlb_key = ERR_PTR(-EAGAIN);
 			spin_unlock(&htlbpage_lock);
-		} else if (check_size_prot(hugetlb_key->in, len, prot, flag) < 0) {
+		} else if (check_size_prot(hugetlb_key, len, prot, flag) < 0) {
 			kfree(hugetlb_key->in);
 			hugetlb_key->key = 0;
 			hugetlb_key = ERR_PTR(-EINVAL);
@@ -360,13 +368,13 @@ void zap_hugepage_range(struct vm_area_s
 	spin_unlock(&mm->page_table_lock);
 }
 
-static int check_size_prot(struct inode *inode, unsigned long len, int prot, int flag)
+static int check_size_prot(struct hugetlb_key *key, unsigned long len, int prot, int flag)
 {
-	if (inode->i_uid != current->fsuid)
+	if (key->uid != current->fsuid)
 		return -1;
-	if (inode->i_gid != current->fsgid)
+	if (key->gid != current->fsgid)
 		return -1;
-	if (inode->i_size != len)
+	if (key->size != len)
 		return -1;
 	return 0;
 }

                 reply	other threads:[~2002-11-12  8:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18BWPl-0005KM-00@holomorphy \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®