Subject: linux-next: manual merge of the net-next tree with the vfs tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 17 May 2018 11:34:50 +1000

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  net/ipv4/ipconfig.c

between commits:

  3f3942aca6da ("proc: introduce proc_create_single{,_data}")
  c04d2cb2009f ("ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers")

from the vfs tree and commit:

  4d019b3f80dc ("ipconfig: Create /proc/net/ipconfig directory")

from the net-next tree.

I fixed it up (see below - there may be more to do) and can carry the
fix as necessary. This is now fixed as far as linux-next is concerned,
but any non trivial conflicts should be mentioned to your upstream
maintainer when your tree is submitted for merging.  You may also want
to consider cooperating with the maintainer of the conflicting tree to
minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc net/ipv4/ipconfig.c
index bbcbcc113d19,86c9f755de3d..000000000000
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@@ -1282,6 -1317,74 +1317,61 @@@ static int pnp_seq_show(struct seq_fil
  			   &ic_servaddr);
  	return 0;
  }
 -
 -static int pnp_seq_open(struct inode *indoe, struct file *file)
 -{
 -	return single_open(file, pnp_seq_show, NULL);
 -}
 -
 -static const struct file_operations pnp_seq_fops = {
 -	.open		= pnp_seq_open,
 -	.read		= seq_read,
 -	.llseek		= seq_lseek,
 -	.release	= single_release,
 -};
 -
+ /* Create the /proc/net/ipconfig directory */
+ static int __init ipconfig_proc_net_init(void)
+ {
+ 	ipconfig_dir = proc_net_mkdir(&init_net, "ipconfig", init_net.proc_net);
+ 	if (!ipconfig_dir)
+ 		return -ENOMEM;
+ 
+ 	return 0;
+ }
+ 
+ /* Create a new file under /proc/net/ipconfig */
+ static int ipconfig_proc_net_create(const char *name,
+ 				    const struct file_operations *fops)
+ {
+ 	char *pname;
+ 	struct proc_dir_entry *p;
+ 
+ 	if (!ipconfig_dir)
+ 		return -ENOMEM;
+ 
+ 	pname = kasprintf(GFP_KERNEL, "%s%s", "ipconfig/", name);
+ 	if (!pname)
+ 		return -ENOMEM;
+ 
+ 	p = proc_create(pname, 0444, init_net.proc_net, fops);
+ 	kfree(pname);
+ 	if (!p)
+ 		return -ENOMEM;
+ 
+ 	return 0;
+ }
+ 
+ /* Write NTP server IP addresses to /proc/net/ipconfig/ntp_servers */
+ static int ntp_servers_seq_show(struct seq_file *seq, void *v)
+ {
+ 	int i;
+ 
+ 	for (i = 0; i < CONF_NTP_SERVERS_MAX; i++) {
+ 		if (ic_ntp_servers[i] != NONE)
+ 			seq_printf(seq, "%pI4\n", &ic_ntp_servers[i]);
+ 	}
+ 	return 0;
+ }
+ 
+ static int ntp_servers_seq_open(struct inode *inode, struct file *file)
+ {
+ 	return single_open(file, ntp_servers_seq_show, NULL);
+ }
+ 
+ static const struct file_operations ntp_servers_seq_fops = {
+ 	.open		= ntp_servers_seq_open,
+ 	.read		= seq_read,
+ 	.llseek		= seq_lseek,
+ 	.release	= single_release,
+ };
  #endif /* CONFIG_PROC_FS */
  
  /*
@@@ -1356,8 -1459,20 +1446,20 @@@ static int __init ip_auto_config(void
  	int err;
  	unsigned int i;
  
+ 	/* Initialise all name servers and NTP servers to NONE (but only if the
+ 	 * "ip=" or "nfsaddrs=" kernel command line parameters weren't decoded,
+ 	 * otherwise we'll overwrite the IP addresses specified there)
+ 	 */
+ 	if (ic_set_manually == 0) {
+ 		ic_nameservers_predef();
+ 		ic_ntp_servers_predef();
+ 	}
+ 
  #ifdef CONFIG_PROC_FS
 -	proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops);
 +	proc_create_single("pnp", 0444, init_net.proc_net, pnp_seq_show);
+ 
+ 	if (ipconfig_proc_net_init() == 0)
+ 		ipconfig_proc_net_create("ntp_servers", &ntp_servers_seq_fops);
  #endif /* CONFIG_PROC_FS */
  
  	if (!ic_enable)